const vFilter = {

  encryptPhone: function(value) {
    return value.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
  },
  deletesdot: function(value) {
    if (!value) return ''
    value = value.toString()
    if (value.slice(-1) === '.') {
      return value.slice(0, -1)
    } else {
      return value
    }
  },
  filterimg: function(value) {
    if (!value) return ''
    value = value.toString()
    if (value.slice(-4) === 'jpeg') {
      return (
        'https://cube.elemecdn.com/' +
        value.charAt(0) +
        '/' +
        value.slice(1, 3) +
        '/' +
        value.slice(3) +
        '.jpeg?x-oss-process=image/format,webp/resize,w_150'
      )
    } else if (value.slice(-3) === 'png') {
      return (
        'https://cube.elemecdn.com/' +
        value.charAt(0) +
        '/' +
        value.slice(1, 3) +
        '/' +
        value.slice(3) +
        '.png?x-oss-process=image/format,webp/resize,w_750'
      )
    } else if (value.slice(-3) === 'jpg') {
      return (
        'https://cube.elemecdn.com/' +
        value.charAt(0) +
        '/' +
        value.slice(1, 3) +
        '/' +
        value.slice(3) +
        '.jpg?x-oss-process=image/resize,m_lfit,w_120/watermark,g_se,x_4,y_4,image_YS8xYS82OGRlYzVjYTE0YjU1ZjJlZmFhYmIxMjM4Y2ZkZXBuZy5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yOA%3D%3D/quality,q_90/format,webp'
      )
    } else {
      return value
    }
  },
  erroraddresss: function(value) {
    if (value === '[]') {
      return ''
    }
    return value.toString()
  }

}
export default vFilter
